package com.mango.module.util;


import javax.jms.Queue;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

@Component
public class QueueUtils {
	
	@Autowired
	 private JmsMessagingTemplate jmsMessagingTemplate;

	
	public void push(String msg) {
		Queue queue=new ActiveMQQueue("hello amq");
		jmsMessagingTemplate.convertAndSend(queue, msg);
	}
	
	/**
	 * 发送队列消息
	 * @param queueName
	 * @param msg
	 */
	public void send(String queueName,String msg) {
		Queue queue=new ActiveMQQueue(queueName);
		jmsMessagingTemplate.convertAndSend(queue, msg);
	}
}
